﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Hello World! with SignalR</title>
    <script src="./Scripts/jquery-1.10.2.min.js"></script>
    <script src="./Scripts/jquery.signalR-2.1.2.min.js"></script>
    <script src="./signalr/hubs" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {

            //defining hub which will have client and server side methods defined.
            var hub = $.connection.helloWorld;

            //defining what the client side "hello" method should do when called.
            //by the server side code.
            hub.client.hello = function () {
                $('#AddText').append('Hello World!<br />');
            }

            //starting the hub and specifying what should server side code should be
            //called when a certain client side event occur.
            $.connection.hub.start().done(function () {
                $('#SubmitButton').click(function () {
                    hub.server.hello();
                });
            });
        });
    </script>
</head>
<body>
    <div id="AddText"></div>
    <input type="button" id="SubmitButton" value="Say Hello" />
</body>
</html>